Optimal. Leaf size=160 \[ -\frac {a^2 (10 A+9 B) \sin ^3(c+d x)}{15 d}+\frac {a^2 (10 A+9 B) \sin (c+d x)}{5 d}+\frac {a^2 (5 A+6 B) \sin (c+d x) \cos ^3(c+d x)}{20 d}+\frac {a^2 (7 A+6 B) \sin (c+d x) \cos (c+d x)}{8 d}+\frac {1}{8} a^2 x (7 A+6 B)+\frac {B \sin (c+d x) \cos ^3(c+d x) \left (a^2 \cos (c+d x)+a^2\right )}{5 d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.28, antiderivative size = 160, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {2976, 2968, 3023, 2748, 2635, 8, 2633} \[ -\frac {a^2 (10 A+9 B) \sin ^3(c+d x)}{15 d}+\frac {a^2 (10 A+9 B) \sin (c+d x)}{5 d}+\frac {a^2 (5 A+6 B) \sin (c+d x) \cos ^3(c+d x)}{20 d}+\frac {a^2 (7 A+6 B) \sin (c+d x) \cos (c+d x)}{8 d}+\frac {1}{8} a^2 x (7 A+6 B)+\frac {B \sin (c+d x) \cos ^3(c+d x) \left (a^2 \cos (c+d x)+a^2\right )}{5 d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2633
Rule 2635
Rule 2748
Rule 2968
Rule 2976
Rule 3023
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+a \cos (c+d x))^2 (A+B \cos (c+d x)) \, dx &=\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}+\frac {1}{5} \int \cos ^2(c+d x) (a+a \cos (c+d x)) (a (5 A+3 B)+a (5 A+6 B) \cos (c+d x)) \, dx\\ &=\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}+\frac {1}{5} \int \cos ^2(c+d x) \left (a^2 (5 A+3 B)+\left (a^2 (5 A+3 B)+a^2 (5 A+6 B)\right ) \cos (c+d x)+a^2 (5 A+6 B) \cos ^2(c+d x)\right ) \, dx\\ &=\frac {a^2 (5 A+6 B) \cos ^3(c+d x) \sin (c+d x)}{20 d}+\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}+\frac {1}{20} \int \cos ^2(c+d x) \left (5 a^2 (7 A+6 B)+4 a^2 (10 A+9 B) \cos (c+d x)\right ) \, dx\\ &=\frac {a^2 (5 A+6 B) \cos ^3(c+d x) \sin (c+d x)}{20 d}+\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}+\frac {1}{4} \left (a^2 (7 A+6 B)\right ) \int \cos ^2(c+d x) \, dx+\frac {1}{5} \left (a^2 (10 A+9 B)\right ) \int \cos ^3(c+d x) \, dx\\ &=\frac {a^2 (7 A+6 B) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 (5 A+6 B) \cos ^3(c+d x) \sin (c+d x)}{20 d}+\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}+\frac {1}{8} \left (a^2 (7 A+6 B)\right ) \int 1 \, dx-\frac {\left (a^2 (10 A+9 B)\right ) \operatorname {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{5 d}\\ &=\frac {1}{8} a^2 (7 A+6 B) x+\frac {a^2 (10 A+9 B) \sin (c+d x)}{5 d}+\frac {a^2 (7 A+6 B) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 (5 A+6 B) \cos ^3(c+d x) \sin (c+d x)}{20 d}+\frac {B \cos ^3(c+d x) \left (a^2+a^2 \cos (c+d x)\right ) \sin (c+d x)}{5 d}-\frac {a^2 (10 A+9 B) \sin ^3(c+d x)}{15 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 0.45, size = 108, normalized size = 0.68 \[ \frac {a^2 (60 (12 A+11 B) \sin (c+d x)+240 (A+B) \sin (2 (c+d x))+80 A \sin (3 (c+d x))+15 A \sin (4 (c+d x))+420 A d x+90 B \sin (3 (c+d x))+30 B \sin (4 (c+d x))+6 B \sin (5 (c+d x))+360 B c+360 B d x)}{480 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [A] time = 0.68, size = 110, normalized size = 0.69 \[ \frac {15 \, {\left (7 \, A + 6 \, B\right )} a^{2} d x + {\left (24 \, B a^{2} \cos \left (d x + c\right )^{4} + 30 \, {\left (A + 2 \, B\right )} a^{2} \cos \left (d x + c\right )^{3} + 8 \, {\left (10 \, A + 9 \, B\right )} a^{2} \cos \left (d x + c\right )^{2} + 15 \, {\left (7 \, A + 6 \, B\right )} a^{2} \cos \left (d x + c\right ) + 16 \, {\left (10 \, A + 9 \, B\right )} a^{2}\right )} \sin \left (d x + c\right )}{120 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [A] time = 0.70, size = 137, normalized size = 0.86 \[ \frac {B a^{2} \sin \left (5 \, d x + 5 \, c\right )}{80 \, d} + \frac {1}{8} \, {\left (7 \, A a^{2} + 6 \, B a^{2}\right )} x + \frac {{\left (A a^{2} + 2 \, B a^{2}\right )} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {{\left (8 \, A a^{2} + 9 \, B a^{2}\right )} \sin \left (3 \, d x + 3 \, c\right )}{48 \, d} + \frac {{\left (A a^{2} + B a^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )}{2 \, d} + \frac {{\left (12 \, A a^{2} + 11 \, B a^{2}\right )} \sin \left (d x + c\right )}{8 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.08, size = 186, normalized size = 1.16 \[ \frac {a^{2} A \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {B \,a^{2} \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+\frac {2 a^{2} A \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 B \,a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+a^{2} A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+\frac {B \,a^{2} \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.36, size = 178, normalized size = 1.11 \[ -\frac {320 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A a^{2} - 15 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} - 120 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} - 32 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} B a^{2} + 160 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a^{2} - 30 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2}}{480 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 1.50, size = 277, normalized size = 1.73 \[ \frac {\left (\frac {7\,A\,a^2}{4}+\frac {3\,B\,a^2}{2}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9+\left (\frac {49\,A\,a^2}{6}+7\,B\,a^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {40\,A\,a^2}{3}+\frac {72\,B\,a^2}{5}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (\frac {79\,A\,a^2}{6}+9\,B\,a^2\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (\frac {25\,A\,a^2}{4}+\frac {13\,B\,a^2}{2}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {a^2\,\left (7\,A+6\,B\right )\,\left (\mathrm {atan}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )-\frac {d\,x}{2}\right )}{4\,d}+\frac {a^2\,\mathrm {atan}\left (\frac {a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (7\,A+6\,B\right )}{4\,\left (\frac {7\,A\,a^2}{4}+\frac {3\,B\,a^2}{2}\right )}\right )\,\left (7\,A+6\,B\right )}{4\,d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [A] time = 2.58, size = 459, normalized size = 2.87 \[ \begin {cases} \frac {3 A a^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 A a^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {A a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {3 A a^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {A a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 A a^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {4 A a^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {5 A a^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} + \frac {2 A a^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {A a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {3 B a^{2} x \sin ^{4}{\left (c + d x \right )}}{4} + \frac {3 B a^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 B a^{2} x \cos ^{4}{\left (c + d x \right )}}{4} + \frac {8 B a^{2} \sin ^{5}{\left (c + d x \right )}}{15 d} + \frac {4 B a^{2} \sin ^{3}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{3 d} + \frac {3 B a^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {2 B a^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {B a^{2} \sin {\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{d} + \frac {5 B a^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{4 d} + \frac {B a^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\relax (c )}\right ) \left (a \cos {\relax (c )} + a\right )^{2} \cos ^{2}{\relax (c )} & \text {otherwise} \end {cases} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________